<?php
if (! defined ( 'BASEPATH' ))
	exit ( 'No direct script access allowed' );

class Storemain extends CI_Controller {
	
	function __construct() {
		parent::__construct ();
	
	}
	
	public function index() {
		$eData = array();
		//		轮播图		
		$this->db->order_by ( 'sort', 'asc' );
		$this->db->order_by ( 'id', 'desc' );
		$this->db->where ( 'cid', 3 );
		$eData['lunboList'] = $this->db->get ('adv',4,0)->result_array ();
		
		//热门小店
		$this->db->where('ishot',1);
		$this->db->limit(6);
		$eData['hotstore'] = $this->db->get('store')->result_array();
//		热门小店的评论		
		$this->db->select('comment.*,store.id as storeid,store.photo as storephoto');
		$this->db->from('comment');
		$this->db->join('store','store.id=comment.belongId');
		$this->db->where('store.ishot',1);
		$this->db->where('type',2);
		$this->db->limit(8);
		$eData['hotcomment'] = $this->db->get()->result_array();
		//最新小店
		$this->db->order_by('createtime','DESC');
		$this->db->limit(4);
		$eData['lateststore'] = $this->db->get('store')->result_array();
		
		//生活
		$this->db->where('name','shenghuo');
		$this->db->order_by('sort', 'ASC');
		$eData['shenghuo'] = $this->db->get('codevalue')->result_array();
		//服饰
		$this->db->where('name','fushi');
		$this->db->order_by('sort', 'ASC');
		$eData['fushi'] = $this->db->get('codevalue')->result_array();
		//文化
		$this->db->where('name','wenhua');
		$this->db->order_by('sort', 'ASC');
		$eData['wenhua'] = $this->db->get('codevalue')->result_array();
		//休闲
		$this->db->where('name','xiuxian');
		$this->db->order_by('sort', 'ASC');
		$eData['xiuxian'] = $this->db->get('codevalue')->result_array();
		//美食
		$this->db->where('name','meishi');
		$this->db->order_by('sort', 'ASC');
		$eData['meishi'] = $this->db->get('codevalue')->result_array();
		//原创品牌
		$this->db->where('name','ycpp');
		$this->db->order_by('sort', 'ASC');
		$eData['ycpp'] = $this->db->get('codevalue')->result_array();
		//特色区域
		$this->db->where('name','tsqy');
		$this->db->order_by('sort', 'ASC');
		$eData['tsqy'] = $this->db->get('codevalue')->result_array();
		//特色区域
		$this->db->where('name','yishu');
		$this->db->order_by('sort', 'ASC');
		$eData['yishu'] = $this->db->get('codevalue')->result_array();
		//特色区域
		$this->db->where('name','ditie');
		$this->db->order_by('sort', 'ASC');
		$eData['ditie'] = $this->db->get('codevalue')->result_array();
		
		$this->load->view ( 'storemain', $eData );
	}
	
	
	
}

